<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/

defined('ANS') or die();

$config['tables'] = array(
	'default' => array(
		'categories' => array(
			'code' => 'id_text',
			'name' => 'varchar',
			'enabled' => 'boolean'
		),

		'comments' => array(
			'code' => 'id_text',
			'text' => 'text',
			'date' => 'datetime',
			'enabled' => 'boolean'
		),

		// boolean codefile date datetime email enum file float gmaps html id_text image integer ip password realfile sort text title url varchar

		'formats' => array(
			'boolean' => array(
				'format' => 'boolean'
			),
			'codefile' => array(
				'format' => 'codefile'
			),
			'date' => array(
				'format' => 'date'
			),
			'datetime' => array(
				'format' => 'datetime'
			),
			'email' => array(
				'format' => 'email'
			),
			'enum' => array(
				'format' => 'enum',
				'values' => array('option1', 'option2')
			),
			'file' => array(
				'format' => 'file'
			),
			'float' => array(
				'format' => 'float',
				'unsigned' => false,
				'value_min' => false
			),
			'gmaps' => array(
				'format' => 'gmaps'
			),
			'html' => array(
				'format' => 'html'
			),
			'id_text' => array(
				'format' => 'id_text'
			),
			'image' => array(
				'format' => 'image'
			),
			'integer' => array(
				'format' => 'integer'
			),
			'ip' => array(
				'format' => 'ip'
			),
			'password' => array(
				'format' => 'password'
			),
			'realfile' => array(
				'format' => 'realfile'
			),
			'sort' => array(
				'format' => 'sort'
			),
			'text' => array(
				'format' => 'text'
			),
			'title' => array(
				'format' => 'title'
			),
			'url' => array(
				'format' => 'url'
			),
			'varchar' => array(
				'format' => 'varchar'
			)
		),

		'posts' => array(
			'code' => 'id_text',
			'title' => 'varchar',
			'text' => 'text',
			'date' => 'datetime',
			'enabled' => 'boolean'
		),

		'users' => array(
			'code' => 'id_text',
			'name' => 'varchar',
			'email' => array(
				'format' => 'email',
				'required' => true,
				'unique' => true
			),
			'enabled' => 'boolean'
		)
	)
);

$config['relations'] = array(
	'default' => array(
		array(
			'tables' => 'categories posts',
			'mode' => 'x x'
		),

		array(
			'tables' => 'comments posts',
			'mode' => 'x 1',
			'dependent' => true
		),

		array(
			'tables' => 'comments users',
			'mode' => 'x 1',
			'dependent' => true
		),

		array(
			'tables' => 'posts users',
			'mode' => 'x 1',
			'dependent' => true
		)
	)
);
?>
